Release 10.1A: OpenEdge Development:
ADM and SmartObjects
ADMProps temp-table and object properties
One mechanism that supports getting and setting many SmartObject properties is the ADMProps temp-table. An ADMProps temp-table is defined for each object; it defines all standard object properties for that object type.
Each SmartObject super procedure uses a Progress include file that defines its own set of properties, and each SmartObject type that uses that super procedure also includes the same list. For example, the super procedure
smart.pdefines functions and procedures that all SmartObjects use and is at the top of the hierarchy of super procedures. This procedure includessmrtprop.i, which defines the basic properties that apply to all SmartObjects. It defines a preprocessor constant for each basic property and also puts aFIELDdefinition for that property in the ADMProps temp-table. In addition, all SmartObjects usesmart.pas a super procedure and include the supporting include filesmart.i. Thesmart.iinclude file also includessmrtprop.i, as well as addingsmart.pas a super procedure.The smrtprop.i (1 of 2) file defines these properties:
If a preprocessor has a name of the form
xppropname, you can access the associated property value directly from its property temp-tableFIELD. The{get}and{set}pseudo-syntax uses this mechanism to optimize references to properties, primarily in super procedures. If it is necessary for eithergetorsetto invoke the corresponding property function (because of some other action it performs), the preprocessor constant is not defined for that property, and references always go through thegetandsetfunctions. For more information, see the "{get} and {set} pseudo-syntax for object properties" section.Now consider a SmartObject defined as a subclass of
smart.p. For example, a SmartDataObject addssmart.pas its first super procedure and then addsquery.panddata.pas the super procedures that define behavior specific to SmartDataObjects. Thedata.pprocedure includes the property include filedataprop.i, which appends more basic values to the list already started bysmrtprop.iand continued byqryprop.i. Each property include file addsFIELDdefinitions to the ADMProps temp-table definition.The dataprop.i (1 of 2) file defines these additional basic properties:
As this example shows, each SmartObject type appends more basic properties to the end of the existing list. The process of appending basic properties to the existing list can be nested to any number of levels of object definition. In this case, both the
data.psuper procedure for SmartDataObjects, and individual SmartObjects themselves, includedataprop.i. Thedataprop.iinclude file in turn includesqryprop.i, which includessmrtprop.i. Basic properties are then initialized in each corresponding object include file (such assmart.ifor all SmartObjects anddata.ifor SmartDataObjects). This initialization both allocatesFIELDs for each basic property and, where appropriate, assigns specific initial values. Because these preprocessor values are included in both the super procedures and in master objects of the type, both have access to them. This allows a super procedure to retrieve a property value directly from the ADMProps temp-table of itsTARGET-PROCEDURE, which is extremely fast, instead of using function calls.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |